package tools.cyan.com.myapplication.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cyan.tools.base.BaseViewHolder;
import com.cyan.tools.base.RecyclerArrayAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;
import tools.cyan.com.myapplication.R;
import tools.cyan.com.myapplication.bean.PhoneRecord;

/**
 * Created by pc on 2018/4/12.
 */

public class PhoneAdapter extends RecyclerArrayAdapter<PhoneRecord> {
    public PhoneAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(parent);
    }

    class ViewHolder extends BaseViewHolder<PhoneRecord> {
        @BindView(R.id.task_mark)
        TextView taskMark;
        @BindView(R.id.time)
        TextView time;
        @BindView(R.id.type)
        TextView type;
        @BindView(R.id.description)
        TextView description;

        public ViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_phone);
            ButterKnife.bind(this,itemView);
        }

        @Override
        public void setData(PhoneRecord data) {
            taskMark.setText(data.getType());
            time.setText(data.getCreated_at());
            type.setText(data.getType());
            description.setText(data.getDetails());
        }
    }
}
